var cc__decorate = __decorate;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $2ADInterface = require("ADInterface");
var $2OppoConstant = require("OppoConstant");
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_OppoAD = /* */function (_i$default2) {
  babel_inherits(r, _i$default2);
  var _super59 = babel_createSuper(r);
  function r() {
    var _this130;
    babel_classCallCheck(this, r);
    _this130 = _super59.apply(this, arguments);
    _this130.isShare = false;
    return _this130;
  }
  babel_createClass(r, [{
    key: "initAd",
    value: function initAd() {
      this.createVideo();
    }
  }, {
    key: "creatInsert",
    value: function creatInsert() {
      this.insertAd = qg.createInterstitialAd({
        adUnitId: $2OppoConstant.default.POSID_NativeAD_InsertAD
      });
    }
  }, {
    key: "createVideo",
    value: function createVideo() {
      this.rewardVideoAd = qg.createRewardedVideoAd({
        adUnitId: $2OppoConstant.default.POSID_VedioAD
      });
    }
  }, {
    key: "showInsert",
    value: function showInsert() {}
  }, {
    key: "showToast",
    value: function showToast(e) {
      qg.showToast({
        title: e
      });
    }
  }, {
    key: "showVideo",
    value: function showVideo(e) {
      var _this131 = this;
      null != this.rewardVideoAd && null != this.rewardVideoAd || this.createVideo();
      this.insertIntervalTime = new Date().getTime();
      this.rewardVideoAd.offClose();
      this.rewardVideoAd.offError();
      this.rewardVideoAd.offLoad();
      cc.game.pause();
      this.rewardVideoAd.onLoad(function () {
        _this131.rewardVideoAd.show().then(function () {
          console.log("广告显示成功");
        }).catch(function (e) {
          cc.game.resume();
          console.log("广告组件出现问题", e);
        });
        console.log("视频加载成功");
      });
      this.rewardVideoAd.onError(function () {
        cc.game.resume();
      });
      this.rewardVideoAd.onClose(function (t) {
        if (t && t.isEnded || undefined === t) {
          e && e();
          _this131.showToast("奖励领取成功");
          cc.game.resume();
        } else {
          _this131.showToast(" 播放中途退出");
          cc.game.resume();
        }
      });
      this.rewardVideoAd.load();
    }
  }, {
    key: "showBanner",
    value: function showBanner() {}
  }, {
    key: "hideBanner",
    value: function hideBanner() {}
  }, {
    key: "addShortcut",
    value: function addShortcut() {}
  }, {
    key: "exitGame",
    value: function exitGame() {
      console.log("推出");
      qg.exitApplication({
        data: 0
      });
    }
  }, {
    key: "log",
    value: function log(e) {
      console.log("WeChatAD:" + e);
    }
  }], [{
    key: "creatorHutuiNine",
    value: function creatorHutuiNine() {
      if (qg.getSystemInfoSync().platformVersionCode >= 1076) {
        this.gamePortalAd = qg.createGamePortalAd({
          adUnitId: $2OppoConstant.default.GamePortalAd
        });
      } else {
        console.log("快应用平台版本号低于1076，暂不支持互推盒子相关 API");
      }
      this.gamePortalAd.load().then(function () {
        console.log("HutuiNine load success");
      }).catch(function (e) {
        console.log("HutuiNine load fail with:" + e.errCode + "," + e.errMsg);
      });
    }
  }, {
    key: "showHutuiNine",
    value: function showHutuiNine() {
      console.log("showHutuiNine");
      this.creatorHutuiNine();
      var e = this;
      this.gamePortalAd.offLoad();
      this.gamePortalAd.onLoad(function () {
        console.log("互推盒子九宫格广告加载成功");
        e.gamePortalAd.show().then(function () {
          console.log("HutuiNine show success");
        }).catch(function (e) {
          console.log("HutuiNine show fail with:" + e.errCode + "," + e.errMsg);
        });
        console.log("HutuiNine show success");
      });
    }
  }, {
    key: "hideHutuiNine",
    value: function hideHutuiNine() {
      this.gamePortalAd.destroy().then(function () {
        console.log("HutuiNine destroy success");
      }).catch(function (e) {
        console.log("HutuiNine destroy fail with:" + e.errCode + "," + e.errMsg);
      });
    }
  }]);
  return r;
}($2ADInterface.default);
def_OppoAD.isSubscribe = false;
def_OppoAD = cc__decorate([ccp_ccclass], def_OppoAD);
exports.default = def_OppoAD;